#ifndef _OLED_H
#define _OLED_H
#include "board.h"
#include <rtthread.h>

#define OLED_SCLK_Clr() rt_pin_write(rt_pin_get("PE.3"), PIN_LOW)//SCL IIC接口的时钟信号
#define OLED_SCLK_Set() rt_pin_write(rt_pin_get("PE.3"),PIN_HIGH)

#define OLED_SDIN_Clr() rt_pin_write(rt_pin_get("PE.2"),PIN_LOW)//SDA IIC接口的数据信号
#define OLED_SDIN_Set() rt_pin_write(rt_pin_get("PE.2"),PIN_HIGH)



#define OLED_MODE 0
#define SIZE 8
#define XLevelL     0x00
#define XLevelH     0x10
#define Max_Column  128     //列
#define Max_Row     64      //行
#define Brightness  0xFF
#define X_WIDTH     128
#define Y_WIDTH     64


#define OLED_CMD  0 //写命令
#define OLED_DATA 1 //写数据

#define IIC_SLAVE_ADDR 0x78  //IIC slave device address

#define u8 uint8_t
#define u32 uint32_t


void IIC_Start();
void IIC_Stop();
void IIC_Wait_Ack();
void Write_IIC_Byte(unsigned char IIC_Byte);
void Write_IIC_Command(unsigned char IIC_Command);
void Write_IIC_Data(unsigned char IIC_Data);
void OLED_WR_Byte(unsigned dat,unsigned cmd);
void fill_picture(unsigned char fill_Data);
void OLED_Set_Pos(unsigned char x, unsigned char y);
void OLED_Display_On(void);
void OLED_Display_Off(void);
void OLED_Clear(unsigned dat);
void OLED_On(void);
void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 Char_Size);
u32 oled_pow(u8 m,u8 n);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size2);
void OLED_ShowString(u8 x,u8 y,u8 *chr,u8 Char_Size);
void OLED_ShowCHinese(u8 x,u8 y,u8 no);
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
void OLED_Init(void);




#endif
